@extends('layouts.header')
@section('content')
    <article class="page-container">
        <div class="c-red">到期15天后不再提醒</div>
        <form class="form form-horizontal" id="form" autocomplete="off" >
            {{ csrf_form_field() }}
            <div class="row cl">
                <label class="form-label col-sm-3">提前通知天数：</label>
                <div class="formControls col-sm-9">
                    <input name="days" type="number" class="input-text" value="{{ isset($data['days']) ? $data['days'] : 30}}" min="1" max="200">
                </div>
            </div>

            @csrf
            <div class="row cl pt-20">
                <div class="col-sm-9 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>
    <script type="text/javascript">
        $(function(){
            var index2;
            $("#form").validate({
                rules:{
                    days:{
                        required:true
                    }
                },
                success:"valid",
                submitHandler:function(form){
                   $(form).ajaxSubmit({
                        type: 'post',
                        url: "",//自己提交给自己可以不写url
                        //beforeSend  beforeSubmit

                        beforeSend : function () {
                            //0.4透明度 白色遮罩
                           index2 = layer.load(2,{ shade: [0.3,'#fff'] });
                        },
                        complete : function () {
                            layer.close(index2);
                        },
                        success: function(data) {
                            //判断添加结果
                            if(data === '1'){
                                parent.location.reload();
                                layer.msg('操作成功!',{ icon: 1, time:2000 });
                                setTimeout(layer_close,1000);
                            }else{
                                layer.msg('操作失败!', { icon: 2, time: 2000 });
                            }
                        },
                        error: function(data) {
                            ajax_error(data);
                        }
                    });
                }
            });
        });
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
@endsection
